package org.springextensions.actionscript.ioc
{
	import org.springextensions.actionscript.ioc.factory.xml.XMLObjectFactory;

	public class MasterResourceGroup extends ResourceGroup
	{
		private var _objectFactory:XMLObjectFactory;
		
		private var _resourceNames:Array;
		
		override public function set resources(value:Array):void
		{
			_resourceNames = value;
		}
		
		public function MasterResourceGroup(objectFactory:XMLObjectFactory)
		{
			super();
			
			_objectFactory = objectFactory;
		}
		
		override public function execute():void 
		{
			var name:String = _resourceNames.shift();

			if (name == null)
			{
				dispatchResult(this);
			}
			else
			{
				addOperation(_objectFactory.getObject(name));
			
				super.execute();
			}
		}
		
	}
}